<?php

namespace app\store\model\bargain;

use app\common\model\bargain\TaskHelpErr as TaskHelpErrModel;

/**
 * 砍价任务助力记录模型
 * Class TaskHelp
 * @package app\store\model\bargain
 */
class TaskHelpErr extends TaskHelpErrModel
{
    /**
     * 获取列表数据
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getList($task_id = null,$md5 = null)
    {
        if(empty($task_id)){
            if($md5){
                $list = $this->with(['user'])
                    ->where('agent_md5', '=', $md5)
                    ->order(['create_time' => 'desc'])
                    ->paginate(15, false, [
                        'query' => \request()->request()
                    ]);
            }else{
                $list = $this->with(['user'])
                    ->order(['create_time' => 'desc'])
                    ->paginate(15, false, [
                        'query' => \request()->request()
                    ]);
            }
        }else{
            // 砍价任务助力记录
            $list = $this->with(['user'])
                ->where('task_id', '=', $task_id)
                ->order(['create_time' => 'desc'])
                ->paginate(15, false, [
                    'query' => \request()->request()
                ]);
        }

        return $list;
    }

}